
from pydantic import BaseModel, Field
from models.base import BaseData
from typing import List, Dict, Any


class TableData(BaseModel):
    query: str = Field('', description='智能问数时的查询语句')
    name: str = Field(default='', description='数据表名')
    fields: str = Field(default='', description='数据表字段的简略说明')
    columns: List = Field(default=[], description='数据表字段的详细说明')
    rows: List[Dict[str, Any]] = Field(default=[], description='行数据')

class AiQueryData(BaseData):
    """智能问数数据"""
    type: str = 'TableData'
    description: str = Field(default='', description='数据表的用途说明')
    data: TableData | None = Field(default=None, description='智能问数查询的表格数据')